Skip to main content

Flow variables vs Contact variables

2 minute read                                                                                                                Intermediate


There are two types of variable substitution you can use in flow editors :

  1. Flow level (@results)
  2. Contact level (@contact)

Going by the basic definition@resultscan be used only on a particular flow and@contactvariables can be used in any flow. Let’s see some use cases.

You may want to store the value/input received from contacts and then use it as a variable especially when sending a message/flow to a large scale of users ex. Hi @contact.name.

These variables can be used on a flow

or

can be fetched and used in another workflow.

  • To use the variable value in the same workflow use _@results.field.input_ in Results field in Wait for response node or use it in send message node to view the value in the chat flow.
  • To use the variable value in another workflow use _@contact.field.fieldname_ in any other work flow in send message node to view the value in the that chat flow.

Example use case: Suppose in the Registration workflow where you get a contact to register with your NGO, you ask for basic contact details for registration.

image

Registration Flow

Sample workflow to get graduate students to register for advanced classes.

image

In this example, the contact information has been captured in the below variables (note the ‘wait for response’ blocks). This will show the value of the variables entered by contact in the flow.

  • @results.contact_name.input
  • @results.contact_email.input
  • @results.college_name.input
  • @results.college_year.input

If you want to show the category of the variable, then you can use category in place of input

  • @results.contact_name.category
  • @results.contact_email.category
  • @results.college_name.category
  • @results.college_year.category

image

Survey Flow

The second workflow has been created to get the feedback of the students who have attended the classes.

In this workflow, the feedback and sending the responses back to the user who has participated in the survey has been captured. The contact information which was saved in the Registration workflow can also be fetched here and used in the responses.

Contact information is fetched with the below syntax for required variables,

  • @contact.fields.contactname
  • @contact.fields.email
  • @contact.fields.collegename
  • @contact.fields.collegeyear

image